package thread_ex;

import java.awt.Color;
import java.awt.Graphics;

import javax.swing.JPanel;

public class Box extends Thread{
	JPanel jp;
	int mx;
	
	int wd = 200;
	int he = 30;
	
	public Box(JPanel p, int m) {
		jp=p;
		mx=m;
	}
	
	public void run(){
		Graphics g = jp.getGraphics();
		
		while(true){
						
			g.setColor(Color.BLACK);
			g.fillRect(mx, jp.getHeight()-100, wd, he);
			jp.removeAll();
						
			try{
				Thread.sleep(50);
			}catch(Exception ex){

			}

		}
		
		
	}

}
